Fill Missing Data
fill_missing(input: any[] | Mat | Tensor, content: Number | any[] | Mat | Tensor, method: String) : any[] | Mat | Tensor
param input
- the data construct to fill the missing entries in
param content
- this is what gets filled in the missing entries. Can be a number constant, array, matrix or tensor. Default is '0'. Note that it can only be an array in certain cases.
param method
- either "constant" or "previous". Constant means using the constant from content. Previous means using the previous value in the input and if no previous value, then use the constant value. Defaults to "constant".
returns: any[] | Mat | Tensor
- the input with the missing values filled
This function is relatively simple - it fills the empty entries in an array, matrix, Mat or Tensor. However there are nuances to it. First, you can decide what it fills it with by setting the content
parameter. Do you want it to put in, say -1's for each missing entry? Or do you want it to put in a 2d matrix in each missing entry? (You would then have a larger matrix as a return value). There's also the method
parameter. Do you want to always fill missing entries with content
? For example, every single missing entry gets filled by content = -1
? Or do you want to set method = "previous"
so that the missing entry uses the previous value of input
?
Below are some examples of various usages of the parameters: